<#assign module="member"/>

<@override name="header">
</@override>
<@override name="body">
<div class="row">
	<div class="col-xs-6" style="width:49%;">
		<div class="btn-group">
			<@shiro.hasPermission name='member'>
				<a class="btn btn-default" href="${ctx}/member/list?type=0">个人用户</a>
		  		<a class="btn btn-default" href="${ctx}/member/list?type=1">企业用户</a>
			  	<a class="btn btn-default" href="${ctx}/member/list?type=2">VIP用户</a>
		  	</@shiro.hasPermission>
		  	<@shiro.hasPermission name='blacklist'>
	  			<a class="btn btn-default active" href="${ctx}/blacklist/list">黑名单</a>
	  		</@shiro.hasPermission>
	  		<@shiro.hasPermission name='phonevisit'>
	  			<a class="btn btn-default" href="${ctx}/phonevisit/list">回访记录</a>
	  		</@shiro.hasPermission>
	  		<@shiro.isMainCompany>
			  <@shiro.hasPermission name='memberapply'>
			  	<a class="btn btn-default" href="${ctx}/memberapply/list">VIP申请</a>
			  </@shiro.hasPermission>
		  	</@shiro.isMainCompany>
		  	<@shiro.hasPermission name='receipt'>
		  		<a class="btn btn-default" href="${ctx}/receipt/list">发票申请</a>
		  	</@shiro.hasPermission>		
  		</div>
  	</div>
	<div class="col-xs-5" style="width:39%;">
	  	<form class="form-inline" role="form">
		  	<div class="form-group">
		  		<input type="text" class="form-control" name="param" value="${param?if_exists}" placeholder="输入电话号码">
		  	</div>
		  	<button type="submit" class="btn btn-default"><i class="icon-search"></i>&nbsp;搜索</button>
	  	</form>
  	</div>
 	<div class="col-xs-1" style="width:12%;">
 		<button class="pull-right button button-rounded button-flat-blue" onclick="window.location='${ctx}/blacklist/add';"><i class="icon-plus"></i>&nbsp;添加黑名单</button>
	</div>
</div>
<div class="row margin-top">
	<div class="col-xs-12">
	<div class="panel panel-primary">
	<div class="table-responsive">
		<table class="table table-hover table-striped">
			<thead>
			<tr style="font-size:14px;">
				<th>电话号码</th>
				<th>备注</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
			  	<#list page.content as data>
					<tr>
						<td>${data.phone?if_exists}</td>
						<td>${data.memo?if_exists}</td>
						<td>
							<a href="${ctx}/blacklist/edit/${data.id}" class="btn-link editthis">编辑</a>
							<a href="javascript:;" data-value="${data.id}" class="btn-link deletethis">删除</a>
						</td>
					</tr>
				</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/blacklist/list">
				<@pg.param name="param" value="${param?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>
</@override>
<@override name="footer">
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
	</script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
	<script type="text/javascript">
		var thisButton;
		function deleteBlackList() {
		    $.post('${ctx}/blacklist/delete',{'id':thisButton.attr("data-value")},function(data){
		            if(data.success){
		            	thisButton.parent().parent().remove();
		                $.scojs_message('删除成功', $.scojs_message.TYPE_OK);
		            } else {
		                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
		            }
		    },'json');
		}
		
		
		$(document).ready(function(){
		    $(".deletethis").click(function(){
		          thisButton = $(this);
		          var confirm = $.scojs_confirm({
		            content: "你真的要删除该黑名单吗？",
		            action:deleteBlackList
		          });
		          confirm.show();
		    });
	
		});
	</script>
</@override>
<@extends name="../layout.ftl"/>